var Hdatas = function () {
    return {
        //main function to initiate the module
        init: function (pageUrl) {
            if (!jQuery().dataTable) {
                return;
            }
            // begin first table
            $("#HdatasTable").dataTable({
                "bDestroy": true,
                "sAjaxSource": pageUrl,
                "bServerSide": true,
                "bProcessing": true,
                "iDisplayLength": 10,
                "sPaginationType": "bootstrap",
                "aLengthMenu": [
                    [10, 25, 50],
                    [10, 25, 50] // change per page values here
                ],
                "aoColumns": [{
                    "mDataProp": "name",
                }, {
                    "mDataProp": "typeName",
                }, {
                    "mDataProp": "xml",
                }, {
                    "mDataProp": "start",
                    "fnRender": function (oObj) {
                        var start = oObj.aData.start;
                        return getFormatTime(start, 'yyyy-MM-dd HH:mm:ss');
                    }
                }, {
                    "mDataProp": "status",
                    "fnRender": function (oObj) {
                        var status = oObj.aData.status;
                        var text="";
                        if(status==0){
                            text="任务运行中";
                        }else if(status==1){
                            text="运行成功";
                        }else if(status==-1){
                            text="运行失败";
                        }
                        return text;
                    }
                }, {
                    "mDataProp": "end",
                    "fnRender": function (oObj) {
                        var end = oObj.aData.end;
                        if(end&&end>0){
                            return getFormatTime(end, 'yyyy-MM-dd HH:mm:ss');
                        }else{
                            return "";
                        }
                    }
                }, {
                    "mDataProp": "consum",
                }],
                "aaSorting": [[3, "dsc"]],
                "oLanguage": {
                    "sProcessing": '<i class="fa fa-coffee"></i>&nbsp;数据加载中...',
                    "sLengthMenu": "_MENU_ 记录",
                    "oPaginate": {
                        "sPrevious": "上一页",
                        "sNext": "下一页"
                    }
                },
            });
            jQuery('#HdatasTable_wrapper .dataTables_filter input').addClass("form-control input-medium"); // modify table search input
            jQuery('#HdatasTable_wrapper .dataTables_length select').addClass("form-control input-small"); // modify table per page dropdown
        }
    };
}();



